function [TrnData_Spec,TrnLabels_Spec,TestData_Spec,TestLabels_Spec,...
    TrnData_Spat,TrnLabels_Spat,TestData_Spat,TestLabels_Spat]=...
    Mugnet_data_preparation(indian_data,indian_padding,train_num,zero_num,test_num)

fprintf('\n ====== MugNet Data Preparation ======= \n')

%% Spectral_Mugnet
TrnData_Spec_train = indian_data(train_num,1:end-2)';%200*number of train pixel+unlabeled pixel
TrnData_Spec_zero = indian_data(zero_num,1:end-2)';

TrnData_Spec = [TrnData_Spec_train TrnData_Spec_zero];%training set of spectral mugnet
TrnLabels_Spec = indian_data(train_num,end-1);%number of train pixel*1
clear TrnData_Spec_train;
clear TrnData_Spec_zero;
TestData_Spec = indian_data(test_num,1:end-2)';%200*number of test pixel
TestLabels_Spec = indian_data(test_num,end-1);%number of test pixel*1

%% Spatial_Mugnet
%training set
for i=1:size(train_num,1)
    lie=ceil(train_num(i,1)/145);
    hang=train_num(i,1)-145*(lie-1);%1-D to row/col
    col=lie+1;row=hang+1;%zero padding
    if i==1
        indian_train_spat=reshape(indian_padding(row-1:row+1,col-1:col+1,:),1,9*200);
    else
        indian_train_spat=[indian_train_spat;reshape(indian_padding(row-1:row+1,col-1:col+1,:),1,9*200)];
    end
end
TrnData_Spat_train = indian_train_spat';%1800*number of train pixel+unlabeled pixel
clear indian_train_spat;
for i=1:size(zero_num,1)
    lie=ceil(zero_num(i,1)/145);
    hang=zero_num(i,1)-145*(lie-1);%1-D to row/col
    col=lie+1;row=hang+1;%zero padding
    if i==1
        indian_zero_spat=reshape(indian_padding(row-1:row+1,col-1:col+1,:),1,9*200);
    else
        indian_zero_spat=[indian_zero_spat;reshape(indian_padding(row-1:row+1,col-1:col+1,:),1,9*200)];
    end
end
TrnData_Spat_zero = indian_zero_spat';%1800*number of train pixel+unlabeled pixel
clear indian_zero_spat;
TrnData_Spat=[TrnData_Spat_train TrnData_Spat_zero];%training set of spatial mugnet
TrnLabels_Spat = indian_data(train_num,end-1);%number of train pixel*1
clear TrnData_Spat_train;
clear TrnData_Spat_zero;
%testing set
for i=1:size(test_num,1)
    lie=ceil(test_num(i,1)/145);
    hang=test_num(i,1)-145*(lie-1);%1-D to row/col
    col=lie+1;row=hang+1;
    if i==1
        indian_test_spat=reshape(indian_padding(row-1:row+1,col-1:col+1,:),1,9*200);
    else
        indian_test_spat=[indian_test_spat;reshape(indian_padding(row-1:row+1,col-1:col+1,:),1,9*200)];
    end
end
TestData_Spat = indian_test_spat';%1800*number of test pixel
clear indian_test_spat;
TestLabels_Spat = indian_data(test_num,end-1);%number of test pixel*1

end